package day10_io_code.com.itheima.d8_demo;

import java.io.File;

public class Demo1_CopyDirectory {
    public static void main(String[] args) {
        try {
            copyDirectory(new File(""),new File(""));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static void copyDirectory(File srcDir, File destDir){
        if (srcDir == null || destDir == null || !srcDir.exists() || !destDir.exists() || srcDir.isFile() || destDir.isFile()){
            return;
        }
        File destNewDir = new File(destDir, srcDir.getName());
        destNewDir.mkdir();

        File[] files = srcDir.listFiles();
        if (files == null || files.length == 0){
            return;
        }
        for (File file : files) {
            if (file.isFile()){
//                FileUtils.copyFile(file, new File(destNewDir, file.getName()));

            }else {
                copyDirectory(file,destNewDir);
            }
        }
    }
}
